
<?php
set_time_limit(0);
if($_GET['option']=="show"){
	$act=$_POST['act'];
	$zipfile=$_POST['zipfile'];
	$folder=$_POST['folder'];	
	
	include_once("pclzip.lib.php");
	$zip	=	new pclzip($zipfile);
	if($act==0){
		$ret = $zip->extract( PCLZIP_OPT_PATH, $folder, PCLZIP_OPT_SET_CHMOD, 0777);
		if($ret==0){
			die("Error : ".$zip->errorInfo(true));
		}else{
				
				echo "<script>alert('Extract ok.'); location.href='?path=$folder';</script>";
		}
 	}else if ($act==1){
		//$rec=$zip->create($folder);
		  $v_list = $zip->create($folder);
		  if ($v_list === 0) {
			die("Error : ".$zip->errorInfo(true));
		  }else{
		  	echo "<script>alert('Create ok.'); location.href='?path=$zipfile';</script>";
		  }
	
	}
 }else{

?><a href="<?php echo $_GET['path'];?>"><?php echo $_GET['path'];?></a><br />
<br />
<form action="?option=show" method="post"><select name="act">
		<option value="1">Creates Zip</option>
			<option value="0">Extract Zip</option>
</select>
<br />
Zip File:
<input type="text" name="zipfile" />
<br />
To Folder
<input type="text" name="folder" />
<br />
<input type="submit" name="Submit" value="submit" /></form>
<?php
}?>